<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>正则对象lastIndex</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
	span.red{
		color: red;
	}
    </style>
</head>
<body>
	<div class="container" id="container">
		<h1>正则对象lastIndex</h1> 
		<p> </p>
	</div>
	<script src="../tools/utils.js"></script>
	<script type="text/javascript">
	let hd = `后盾人不断分享视频教程，后盾人网址是 houdunren.com`;
	let reg = /后盾人(.{2})/g;
	console.log(hd.lastIndexOf('人'))
	
	reg.lastIndex = 10; //从索引10开始搜索
	console.log(reg.exec(hd));
	console.log(reg.lastIndex);

	reg = /\p{sc=Han}/gu;
	while ((res = reg.exec(hd))) {
	  console.log(res[0]);
	}

	</script>
</body>
</html>